#ifndef SEMANTICNODEFIELD_H_
#define SEMANTICNODEFIELD_H_




//TODO brisi
#include "OurSemanticAnalyzer.h"




#include "SemanticNode.h"
#include "SemanticNodeExpression.h"
#include "ValueType.h"
#include "../syntax_tree.h"
#include "../main_container.h"

#include <string>
#include <sstream>
#include <map>
#include <vector>

extern MainContainer *CompilerData;

class SemanticNodeField : public SemanticNode, public ValueType {
private:
		/** Modifikatori varijable. */
	enum VarMod {
		Public    = 0x01,
		Private   = 0x02,
		Protected = 0x04,
		Static    = 0x08
	};

	/** Podaci o modifikatorima. */
	char mod;

	std::string name;
	SemanticNodeExpression *initExpression;


	//friend std::string flattenTypeName(const SyntaxTreeNode &typeNode);
	//friend std::vector<std::string> flattenTemplateIdentifiers(const SyntaxTreeNode &templateUseNode);

public:
	SemanticNodeField(const SyntaxTreeNode *modifiers, const SyntaxTreeNode *varType, const SyntaxTreeNode *varName, SemanticNode *parentNode);
	std::string getName();

	void setInitExpression(SemanticNodeExpression *nodeExpression);

	bool isInitialized();

	// Modifiers
	bool isPublic();
	bool isPrivate();
	bool isProtected();
	bool isStatic();

	// Types
	bool isInt();
	bool isFloat();
	bool isBool();
	bool isState();
	bool isTime();
	bool isVoid();
	bool isFacility();
	bool isStorage();
	bool isQueue();
	bool isADTable();
	bool isGroup();
	bool isOutputStream();
	bool isUserDefinedType();

	virtual std::string toDebugString(int tab);

public:
	static std::vector<SemanticNodeField *> analyzeNodeField(const SyntaxTreeNode *fieldNode, SemanticNode *parent);
};

#endif /* SEMANTICNODEFIELD_H_ */
